<!--
 * @Author: 哈尔滨大拐 3181845089@qq.com
 * @Date: 2022-07-10 17:12:06
 * @LastEditors: 哈尔滨大拐 3181845089@qq.com
 * @LastEditTime: 2022-07-10 17:25:46
 * @FilePath: \mygit\实验\16-history.html
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>

    <h1>second page</h1>
    <a href="./10-无限滚动&回到顶部.html">嘿嘿嘿</a>
    <button onclick="myBack()">返回</button>
    <button onclick="myForward()">下一页</button>
    <button onclick="myGo()">去到第几条历史记录</button>
    <button onclick="myPushState()">插入一条新的历史记录</button>
    <button onclick="myReplaceState()">替换当前历史记录</button>
    <button onclick="historyInfo()">打印历史信息</button>

    <script>
        function myBack() {
            //返回上一页
            history.back()
        }
        function myForward() {
            //去到下一页
            history.forward()
        }
        function myGo() {
            //去到第几个历史记录页面
            history.go(1)
        }
        function myPushState() {
            //插入一条新的历史记录,位于第二页
            // history.pushState({}, null, "./12-日期.html");
            history.pushState({}, null);
        }
        function myReplaceState() {
            //替换当前历史记录
        }
        function historyInfo() {
            // 打印历史记录相关信息
            console.log(history);
        }
    </script>
</body>

</html>